//
//  Common.m
//  NetPhone
//
//  Created by intel intel on 12-4-27.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "Common.h"
#import "NetPhoneDAO.h"
#import "CallViewController.h"
#import "KeyboardView.h"
#import "iToast.h"

@implementation Common

+(void)iToast:(NSString *)msg
{
    iToast *toast = [iToast makeText:msg];
    [toast show];
}

+(void)callWithNumber:(NSString *)value name:(NSString *)name
{
    if (value && ![value isEqualToString:@""] && value.length >= 3)
    {
        value=[value stringByReplacingOccurrencesOfString:@"-" withString:@""];
        value=[value stringByReplacingOccurrencesOfString:@"+" withString:@""];
        value=[value stringByReplacingOccurrencesOfString:@" " withString:@""];
        [[NetPhoneDAO sharedInstance] insertCallRecrod:value name:name];
        [CallViewController callWithNumber:value name:name];
        [[KeyboardView sharedInstance]setNewTitle:@""];
    }
}
+(void)callWithNumber:(NSString *)value name:(NSString *)name AndTheType:(int)dialType
{
    if (value && value.length >= 3)
    {
        value=[value stringByReplacingOccurrencesOfString:@"-" withString:@""];
        value=[value stringByReplacingOccurrencesOfString:@"+" withString:@""];
        value=[value stringByReplacingOccurrencesOfString:@" " withString:@""];
        [[NetPhoneDAO sharedInstance] insertCallRecrod:value name:name];
        [CallViewController callWithNumber:value name:name AndDialType:dialType];
        [[KeyboardView sharedInstance]setNewTitle:@""];
    }
}


@end
